#include "CSettings.h"

CSettings::CSettings()
{
    this->settings = new QSettings("supinfo", "bombworld");
}

CSettings::~CSettings()
{
    delete this->settings;
}

void CSettings::save_settings(QString hostname, bool show_hud, int theme)
{
    MStaticData::show_hud = show_hud;
    MStaticData::cas_hostname = hostname;
    MStaticData::chat_hostname = hostname;

    settings->setValue("show_hud", show_hud);
    settings->setValue("cas_hostname", hostname);
    settings->setValue("chat_hostname", hostname);
    settings->setValue("theme", theme);
}

void CSettings::load_settings()
{
    MStaticData::show_hud = settings->value("show_hud", true).toBool();
    MStaticData::cas_hostname = settings->value("cas_hostname").toString();
    MStaticData::chat_hostname = settings->value("chat_hostname").toString();
    CDesign::get_instance()->set_i(settings->value("theme").toInt());
}
